package com.yang.lesson06;

import javax.swing.*;
import java.awt.*;
import java.util.Vector;

public class TestComboboxDemo02 extends JFrame {
    public TestComboboxDemo02() {
        Container container = this.getContentPane();

        //生成列表内容   稀疏数组  压缩数据
        //静态String[] contents = {"1","2","3"};
        //动态
        Vector contents = new Vector();
        //列表中需要放入内容
        JList list = new JList(contents);

        contents.add("1");
        contents.add("1");
        contents.add("1");

        container.add(list);

        this.setVisible(true);
        this.setSize(500,400);
        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    }

    public static void main(String[] args) {
        new TestComboboxDemo02();
    }

}
